#! /bin/sh

set -x

# make spike  data and  set headers
suspike nt=256 ntr=512 nspk=1 it1=128 ix1=256 |
sushw key=dt,d2,cdp a=4000,4,1 b=0,0,1 >data.su

# make background velocity profile
makevel nx=512 nz=256 dvdx=0.0 dvdz=0.0 v000=2500 >vfile.temp

# transpose background wavespeed profile
# for sumigsplit, sumigfd, sumigffd, sumigpspi
transp n1=512 < vfile.temp > vfile2

# perform fd migrations
sumigsplit < data.su nz=256 dz=5 vfile=vfile2 > mig.split
sumigffd < data.su nz=256 dz=5 vfile=vfile2 > mig.ffd
sumigfd < data.su nz=256 dz=5 vfile=vfile2 > mig.fd
sumigpspi < data.su nz=256 dz=5 vfile=vfile2 > mig.pspi

# perform phase shift (Gazdag) migrations
sugazmig < data.su vmig=2500 > mig.gazdag
sumigps < data.su vmig=2500 > mig.phaseshift

# perform stolt migration
sustolt < data.su > mig.stolt verbose=1 cdpmin=1 cdpmax=512 dxcdp=4 tmig=0 vmig=2500 


# display impulse responses
suximage < data.su wbox=300 hbox=300 xbox=10 ybox=10 \
   title="Test impulse data" &
suximage < mig.split wbox=300 hbox=300 xbox=330 ybox=10 \
   title="Split Step" &
suximage < mig.ffd  wbox=300 hbox=300 xbox=630 ybox=10 \
   title="Fourier Finite Difference" &
suximage < mig.fd wbox=300 hbox=300 xbox=10 ybox=330 \
   title="Finite Difference" &
suximage < mig.pspi wbox=300 hbox=300 xbox=330 ybox=330 \
   title="PSPI" &
suximage < mig.stolt wbox=300 hbox=300 xbox=630 ybox=330 \
   title="Stolt" &
suximage < mig.gazdag wbox=300 hbox=300 xbox=10 ybox=10 \
   title="Gazdag" &

exit 0
